import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import 'normalize.css/normalize.css'
import './assets/index.scss'
import * as filters from '@/utils/filters'
import service from  '@/utils/request'
import { getUrlParams } from '@/utils/index'
import Axios from 'axios'
import zh_tran from "@/assets/langs/lang.js";



Object.keys(filters).forEach(key => Vue.filter(key, filters[key]));
Vue.use(ElementUI);
Vue.prototype.$zh_tran=zh_tran;

let token = getUrlParams('token')
if(token){
  window.localStorage.setItem('token',token);
}
window.localStorage.setItem('source','usercenter');
let saveToken = window.localStorage.getItem('token');
let saveSource = window.localStorage.getItem('source');
service.defaults.headers.common['token'] = saveToken;
service.defaults.headers.common['source'] = saveSource;
service.defaults.headers.common['Content-Type']= 'application/x-www-form-urlencoded';

store.dispatch('getUser')

Vue.prototype.$axios = Axios

Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
